//
//  PARegisterResultView.m
//  PAMobileWallet
//
//  Created by Pay_SMP002 on 13-7-3.
//  Copyright (c) 2013年 平安付. All rights reserved.
//

#import "PARegisterResultView.h"
#import "PAResultViewController.h"

@implementation PARegisterResultView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        CGFloat x, y, w, h;

        x = 0;  y = 44;  w = 320;  h = 50;
        UIImageView * registerBgImage = [[UIImageView alloc] initWithFrame:CGRectMake(x, y, w, h)];
        registerBgImage.backgroundColor = [UIColor clearColor];
        registerBgImage.image = [UIImage imageNamed:@"refister_sucess.png"];
        [self addSubview:registerBgImage];
        
        x = 117/2;  y = 44 + 18/2;  w = 82/2;  h = 82/2;
        UIImageView * sucessBgImage = [[UIImageView alloc] initWithFrame:CGRectMake(x, y, w, h)];
        sucessBgImage.backgroundColor = [UIColor clearColor];
        sucessBgImage.image = [UIImage imageNamed:@"refister_sucessBT.png"];
        [self addSubview:sucessBgImage];

        x = 117/2 + 82/2 + 10;  y = 44 + 18/2;  w = 320 - (117/2 + 82/2 + 10);  h = 82/2;
        UILabel * sucessLable = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w, h)];
        sucessLable.text = @"恭喜您！已注册成功";
        sucessLable.backgroundColor = [UIColor clearColor];
        sucessLable.textAlignment = NSTextAlignmentLeft;
        sucessLable.font = [UIFont systemFontOfSize:17.0f];
        sucessLable.textColor = [UIColor darkTextColor];
        [self addSubview:sucessLable];

        x = 20;  y = 44 + 50 + 15;  w = 280;  h = 100;
        UILabel * luckLable = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w, h)];
        luckLable.text = @"马上绑定银行卡,就可以体验更快捷的付款啦。\n现在就去试试！";
        luckLable.backgroundColor = [UIColor clearColor];
        luckLable.textAlignment = NSTextAlignmentLeft;
        luckLable.font = [UIFont systemFontOfSize:18.0f];
        luckLable.textColor = [UIColor darkTextColor];
        luckLable.numberOfLines = 0;
        [self addSubview:luckLable];

        //x = 10;  y = 44 + 50 + 15 + 100 + 10;  w = 258/2;  h = 82/2;
        x = 10;  y = 44 + 50 + 15 + 100 + 10;  w = 274/2;  h = 96/2;
        UIButton *ticketButton = [UIButton buttonWithType:UIButtonTypeCustom];
        ticketButton.frame = CGRectMake(x, y, w, h);
        [ticketButton setTitle:@"去绑卡" forState:UIControlStateNormal];
        [ticketButton setBackgroundImage:[UIImage imageNamed:@"small_button_A1.png"] forState:UIControlStateNormal];
        [ticketButton setBackgroundImage:[UIImage imageNamed:@"small_button_A2.png"] forState:UIControlStateHighlighted];
        ticketButton.titleLabel.textColor = ABLE_COLOR;
        //ticketButton.titleLabel.textColor = [UIColor darkTextColor];
        [ticketButton addTarget:self action:@selector(buttonActive:) forControlEvents:UIControlEventTouchUpInside];
        ticketButton.tag = 0;
        [self addSubview:ticketButton];

        //x = 320 - 10 - 258/2;  y = 44 + 50 + 15 + 100 + 10;  w = 258/2;  h = 82/2;
        x = 320 - 10 - 274/2;  y = 44 + 50 + 15 + 100 + 10;  w = 274/2;  h = 96/2;
        UIButton *homePageButton = [UIButton buttonWithType:UIButtonTypeCustom];
        homePageButton.frame = CGRectMake(x, y, w, h);
        [homePageButton setTitle:@"去首页" forState:UIControlStateNormal];
        [homePageButton setBackgroundImage:[UIImage imageNamed:@"small_button_B1.png"] forState:UIControlStateNormal];
        [homePageButton setBackgroundImage:[UIImage imageNamed:@"small_button_B2.png"] forState:UIControlStateHighlighted];
        //homePageButton.titleLabel.textColor = [UIColor darkTextColor];
        homePageButton.titleLabel.textColor = ENABLE_COLOR;
        [homePageButton addTarget:self action:@selector(buttonActive:) forControlEvents:UIControlEventTouchUpInside];
        homePageButton.tag = 1;
        [self addSubview:homePageButton];
    }
    return self;
}

-(void)buttonActive:(id)sender
{
    [self.parentController testNext:sender];
}

@end
